﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using UnityEngine;

public class DelayPlayAnimationBySiblingIndex : MonoBehaviour
{
    public Animator anim;
    public float delayFactor = 0.2f;

    [ContextMenu("GetAnimatorInChildren")]
    private void GetAnimatorInChildren()
    {
        this.anim = base.GetComponentInChildren<Animator>();
    }

    [DebuggerHidden]
    private IEnumerator Start()
    {
        return new <Start>c__Iterator14 { <>f__this = this };
    }

    [CompilerGenerated]
    private sealed class <Start>c__Iterator14 : IDisposable, IEnumerator, IEnumerator<object>
    {
        internal object $current;
        internal int $PC;
        internal DelayPlayAnimationBySiblingIndex <>f__this;
        internal float <originalSpeed>__0;

        [DebuggerHidden]
        public void Dispose()
        {
            this.$PC = -1;
        }

        public bool MoveNext()
        {
            uint num = (uint) this.$PC;
            this.$PC = -1;
            switch (num)
            {
                case 0:
                    this.<originalSpeed>__0 = this.<>f__this.anim.speed;
                    this.<>f__this.anim.speed = 0f;
                    this.$current = new WaitForSeconds(this.<>f__this.delayFactor * this.<>f__this.transform.GetSiblingIndex());
                    this.$PC = 1;
                    return true;

                case 1:
                    this.<>f__this.anim.speed = this.<originalSpeed>__0;
                    this.$PC = -1;
                    break;
            }
            return false;
        }

        [DebuggerHidden]
        public void Reset()
        {
            throw new NotSupportedException();
        }

        object IEnumerator<object>.Current
        {
            [DebuggerHidden]
            get
            {
                return this.$current;
            }
        }

        object IEnumerator.Current
        {
            [DebuggerHidden]
            get
            {
                return this.$current;
            }
        }
    }
}

